<?php

use Illuminate\Database\Seeder;
use App\Models\Admin\Admin;
use App\Models\Admin\Role;
use App\Models\Admin\Permission;

class AdminTableSeeder extends Seeder
{
    /**
     * Run the database seeds.
     *
     * @return void
     */
    public function run()
    {
        $admin = new Admin();
        $admin->name     = 'Administrator';
        $admin->email    = 'lwx12525@outlook.com';
        $admin->password = Hash::make('IMlooker12');
        $admin->save();

        $administrator = new Role();
        $administrator->name         = 'administrator';
        $administrator->display_name = '超级管理员';
        $administrator->description  = '所有用户管理,RBAC管理等等';
        $administrator->save();

        $manager = new Role();
        $manager->name         = 'manager';
        $manager->display_name = '管理员';
        $manager->description  = '网站内容审核、管理';
        $manager->save();

        $admin->attachRole($administrator);
        $admin->attachRole($manager);
    }
}
